﻿@model IList<NodeOnline>
@using Stardust.Data.Nodes;
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@using XCode.Membership;
@using NewLife.Cube;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var set = ViewBag.PageSetting as PageSetting;
    //var provider = ManageProvider.Provider;
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("ID"))">编号</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("CityID"))">地区</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Category"))">类别</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("NodeID"))">设备</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Name"))">名称</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("IP"))">本地IP</a></th>
            <th class="text-center">数据</th>
            <th class="text-center">诊断</th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("PingCount"))">心跳</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Version"))">版本</a></th>
            <th class="text-center" title="内存。单位M"><a href="@Html.Raw(page.GetSortUrl("Memory"))">内存</a></th>
            <th class="text-center" title="可用内存。单位M"><a href="@Html.Raw(page.GetSortUrl("AvailableMemory"))">可用内存</a></th>
            <th class="text-center" title="可用磁盘。应用所在盘，单位M"><a href="@Html.Raw(page.GetSortUrl("AvailableFreeSpace"))">可用磁盘</a></th>
            <th class="text-center" title="CPU率。占用率"><a href="@Html.Raw(page.GetSortUrl("CpuRate"))">CPU率</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Temperature"))">温度</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Battery"))">电量</a></th>
            <th class="text-center" title="上行速度。网络发送速度，字节每秒"><a href="@Html.Raw(page.GetSortUrl("UplinkSpeed"))">上行速度</a></th>
            <th class="text-center" title="下行速度。网络接收速度，字节每秒"><a href="@Html.Raw(page.GetSortUrl("DownlinkSpeed"))">下行速度</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("ProcessCount"))">进程数</a></th>
            <th class="text-center" title="传输数据Established的Tcp网络连接数"><a href="@Html.Raw(page.GetSortUrl("TcpConnections"))">连接数</a></th>
            <th class="text-center" title="主动关闭后TimeWait的Tcp网络连接数，下一步Closed"><a href="@Html.Raw(page.GetSortUrl("TcpTimeWait"))">主动关闭</a></th>
            <th class="text-center" title="被动关闭后CloseWait的Tcp网络连接数，下一步TimeWait"><a href="@Html.Raw(page.GetSortUrl("TcpCloseWait"))">被动关闭</a></th>
            <th class="text-center" title="延迟。网络延迟，单位ms"><a href="@Html.Raw(page.GetSortUrl("Delay"))">延迟</a></th>
            <th class="text-center" title="偏移。客户端时间减服务端时间，单位s"><a href="@Html.Raw(page.GetSortUrl("Offset"))">偏移</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("LocalTime"))">本地时间</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Creator"))">创建者</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("CreateTime"))">创建时间</a></th>
            <th class="text-center" title="创建者。服务器节点"><a href="@Html.Raw(page.GetSortUrl("CreateIP"))">创建地址</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("UpdateTime"))">更新时间</a></th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (set.EnableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity.ID" /></td>
                }
                <td class="text-center">@entity.ID</td>
                <td class="text-center">@entity.CityName</td>
                <td class="text-center"><a href="?category=@entity.Category">@entity.Category</a></td>
                <td class="text-center"><a href="Node?id=@entity.NodeID">@entity.NodeName</a></td>
                <td>@entity.Name</td>
                <td title="@entity.IP" style="max-width:200px;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">@entity.IP</td>
                <td><a href="NodeData?nodeId=@entity.NodeID">数据</a></td>
                <td><a href="Node/Trace/@entity.NodeID">诊断</a></td>
                <td class="text-right">@entity.PingCount.ToString("n0")</td>
                <td title="@entity.CompileTime.ToFullString("")">@entity.Version</td>
                <td class="text-right">@entity.Memory.ToString("n0")</td>
                <td class="text-right">@entity.AvailableMemory.ToString("n0")</td>
                <td class="text-right">@entity.AvailableFreeSpace.ToString("n0")</td>
                <td class="text-center">@entity.CpuRate.ToString("p2")</td>
                <td class="text-center">@entity.Temperature.ToString("N1") °C</td>
                <td class="text-center">@entity.Battery.ToString("p0")</td>
                <td class="text-right">@entity.UplinkSpeed.ToString("n0")</td>
                <td class="text-right">@entity.DownlinkSpeed.ToString("n0")</td>
                <td class="text-right">@entity.ProcessCount.ToString("n0")</td>
                <td class="text-right">@entity.TcpConnections.ToString("n0")</td>
                <td class="text-right">@entity.TcpTimeWait.ToString("n0")</td>
                <td class="text-right">@entity.TcpCloseWait.ToString("n0")</td>
                <td class="text-right">@entity.Delay.ToString("n0")</td>
                <td class="text-right">@entity.Offset.ToString("n0")</td>
                <td class="text-center">@entity.LocalTime.ToFullString("")</td>
                <td class="text-center">@entity.Creator</td>
                <td class="text-center">@entity.CreateTime.ToFullString("")</td>
                <td class="text-center" title="@entity.CreateIP.IPToAddress()">@entity.CreateIP</td>
                <td class="text-center">@entity.UpdateTime.ToFullString("")</td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>